package com.线程;

import java.util.concurrent.TimeUnit;

public class 实际变量局部变量成员变量 {


    public static void main(String[] args) throws InterruptedException {
        int is =  0 ;
        for (int i =0; i <100;i++){

        }

    }
}

class Shili implements  Runnable{

    int count = 0 ;

    private Shili(){};

 static Shili shili = null ;


    public static Shili getInstance(){

        if(shili == null ){
            shili = new Shili();
        }
        return shili;
    }



    @Override
    public void run() {

     //   synchronized(this) {
            for (int i = 0; i < 1000; i++) {
                count++;

                System.out.println(Thread.currentThread().getName() + ":" + count);
            }
       // }
    }


    public static void main(String[] args) {
        for(int i = 0 ; i <1000;i++){
            new Thread(Shili.getInstance()).start();
        }


    }
}

class T implements  Runnable{

    static int staticInt = 0 ;

    int int1 = 0 ;


    @Override
    public void run() {

        int int2 = 0 ;


        for(int i = 0;i < 1000;i++){

            staticInt++;

            int1++;

            int2++;

           // System.out.println(Thread.currentThread().getName()+"---"+int1);

            System.out.println(Thread.currentThread().getName()+"---"+int2);

        }


    }


    public int get(){
        return int1;
    }

    public static void main(String[] args) {
        T t = new T();

        for(int ie = 0 ;ie<100;ie++ ){
            new Thread(new T()).start();
        }

        try {
            TimeUnit.SECONDS.sleep(10);

        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }
}
